package dev.ece.core.engine;

public interface EngineEvent {
	
	public static class Pointer {
		
		private int x;
		private int y;
		
		public Pointer() {}
		
		public Pointer(int x, int y) {
			this.x = x;
			this.y = y;
		}
		
		public Pointer(Pointer pointer) {
			this.x = pointer.x;
			this.y = pointer.y;
		}
		
		protected void setPosition(int x, int y) {
			this.setX(x);
			this.setY(y);
		}
		protected void setX(int x) {
			this.x = x;
		}
		protected void setY(int y) {
			this.y = y;
		}
		
		public boolean close(Pointer pointer) {
			return Math.abs(pointer.x - this.x) < 5 && Math.abs(pointer.y - this.y) < 5; 
		}
		
		public int getX() {
			return x;
		}
		public int getY() {
			return y;
		}
		
		public String toString() {
			return new StringBuffer().append("[").append(x).append(",").append(y).append("]").toString();
		}
		
	}

	public void onKeyBoardEvent(long window, int key, int scancode, int action, int mods) throws Exception;
	
	public void onJoyStickEvent(int jid, int event) throws Exception;
	
	public void onJoyStickEvent(Joystick joystick, int button, int event) throws Exception;
	
	public void onJoyStickAxesEvent(Joystick joystick, int axe, float value) throws Exception;
	
	public void onMouseButtonEvent(long window, int button, int action, int mods, Pointer pointer) throws Exception;
	
	public void onMouseMoveEvent(long window, Pointer pointer) throws Exception;
	
	public void onMouseScrollEvent(long window, double xoffset, double yoffset, Pointer pointer) throws Exception;
	
}
